package com.frxuexi.mdm2203.demo

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.frxuexi.mdm2203.R


@Preview
@Composable
fun Greeting() {
    //Column:垂直排列，Row:水平排列
    /*Column {
        Text(
            text = "Hello $name!"
        )
        Text(
            text = "my name "
        )
    }*/
    /*Row {
        Image(modifier = Modifier.size(50.dp), alpha = 0.5f, painter = painterResource(id = R.drawable.ic_launcher_background), contentDescription = "")
//        Icon(imageVector = Icons.Default.ArrowBack, contentDescription = "")
        Column {
            Text(
                "Hello $name!"
            )
            Text(
                text = "my name "
            )
        }

    }*/

    //horizontalArrangement:水平方向的排列方式，center：居中、SpaceBetween：两端靠边均分，SpaceAround:完全均分，内容居中，SpaceEvenly:均分，空白宽度一样
//    Row(modifier = Modifier.fillMaxSize(),horizontalArrangement= Arrangement.SpaceEvenly,verticalAlignment= Alignment.CenterVertically) {
//        Text(text = "hello")
//        Text(text = "hello")
//        Text(text = "hello")
//        Text(text = "hello")
//    }

    Column(Modifier.fillMaxSize(),verticalArrangement= Arrangement.SpaceEvenly, horizontalAlignment = Alignment.CenterHorizontally) {
        Text(text = "hello", color = Color.Blue, fontSize = 22.sp, fontWeight = FontWeight.Bold,letterSpacing=2.sp,textAlign= TextAlign.Start,overflow= TextOverflow.Ellipsis, modifier = Modifier.width(10.dp), maxLines = 2)
        Text(text = "hello", color = colorResource(id = R.color.purple_200))
        Text(text = "hello")
        Text(text = "hello", modifier = Modifier.background(
            colorResource(id = R.color.purple_200),
            RoundedCornerShape(20.dp)
        ).border(2.dp, Color.Gray, RoundedCornerShape(20.dp)).padding(15.dp,3.dp))
    }
    /*Image(painter = painterResource(id = R.drawable.ic_launcher_background), contentDescription ="",
        modifier = Modifier.clip(RoundedCornerShape(20.dp)))*/


}